export type LoginParams =
  | {
      username: string;
      password: string;
      grant_type: 'password';
    }
  | {
      username: string;
      verify_code: string;
      grant_type: 'sms';
    };

export const userLogin_old = (params: LoginParams) => {
  return get(Prefix.selection + '/oauth/token', params);
};

export const userLogin = (params: LoginParams) => {
  return post(Prefix.api + '/user/login', params);
};

export const userLoginOut = () => {
  return post(Prefix.api + '/user/logout');
};

export const userDetail = () => {
  return get(Prefix.api + '/user/details');
};



export const updatePwd = (params: {
  password: string;
  phone: string;
  verifyCode: string;
}) => {
  return post(Prefix.selection + '/user/forget-pwd/update', params);
};

export const userRegister = (params: {
  name: string;
  password: string;
  phone: string;
  verifyCode: string;
  aesPassword: string
}) => {
  return post(Prefix.selection + '/user/register', params);
};
